import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import 'lib-flexible/flexible'
import { Skeleton,PullRefresh,Icon, NavBar, Sticky, Loading, Toast, DropdownMenu, DropdownItem, Cell, Rate, Button, Tabbar, TabbarItem, Switch, Slider, Tabs, Tab, Sidebar, SidebarItem, Lazyload, Swipe, SwipeItem, Popup } from 'vant';
import './assets/css/base.css';
import './assets/css/normalize.css';
import './assets/css/reset.css';
Vue.use(Skeleton).use(PullRefresh).use(Icon).use(NavBar).use(DropdownMenu).use(Sticky).use(Loading).use(Toast).use(DropdownItem).use(Popup).use(Rate).use(Cell).use(Button).use(Tabbar).use(TabbarItem).use(Switch).use(Slider).use(Tabs).use(Tab).use(Sidebar).use(SidebarItem).use(Lazyload).use(Swipe).use(SwipeItem);
import _ from 'lodash';
import '../node_modules/vant/lib/index.css';
import './assets/font/iconfont'
import './assets/js/rem'
Vue.prototype.$toast = Toast
Vue.config.productionTip = false
Vue.prototype._ = _;



Vue.filter('imageView', function (value) {
  if (!value) return '';
  value = value.toString();
  return value + '?param=140y140'
})
Vue.filter('computedTime', function (value) {
  if (!value || value == 0) return '';
  let date = new Date(value);
  let m = date.getMonth() + 1;//因为是月从0开始，所以得加1
  let d = date.getDate();
  return m + '月' + d + '日';
})

Vue.filter('computedCount', function (value) {
  if (!value || value == 0) return 0;
  let count;
  if (value >= 100000000) {
    count = (value / 100000000).toFixed(1) + "亿";
  } else {
    count = value >= 10000 ? (value / 10000).toFixed(1) + "万" : value;
  }
  return count;
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
